# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  include UserInfo
  helper :all # include all helpers, all the time
  
  before_filter :set_user
  

  ActiveScaffold.set_defaults do |config|
    # disables dhtml history globally
    config.theme = :blue
  end
  


  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '9a45b429412f6a2c4d6cb6d46dfe46a1'


  protected
  def authenticate
   unless session[:username]
     session[:original_uri] = request.request_uri 
     redirect_to :controller => "login"
     return false
   end
  end
 
  # Sets the current user into a named Thread location so that it can be accessed
    # by models and observers
    def set_user
      UserInfo.current_user = session[:username]
    end


end
